//package com.bart.hsp.scala.ch11.sec10

abstract class Amount
case class Dollar(value: Double) extends Amount
case class Currency(value: Double, unit: String) extends Amount

case object Nothing extends Amount

val amt = Currency(29.95, "EUR")
// 拷贝得到一个新对象【深度拷贝】修改新对象不影响旧对象的值
val price = amt.copy(value = 19.95)
println(price)
println(amt)
println(amt.copy(unit = "CHF"))
//Currency(19.95,EUR)
//Currency(29.95,EUR)
//Currency(29.95,CHF)